package com.invengo.module_robot;

import com.alibaba.android.arouter.launcher.ARouter;
import com.invengo.base.router.RouterActivityPath;

public class TiggerManager {
    public static  TiggerManager Instance;
    private TiggerManager(){}

    public static TiggerManager getInstance() {
        if (Instance==null){
            synchronized (TiggerManager.class){
                if (Instance==null)
                    Instance = new TiggerManager();
            }
        }
        return Instance;
    }

    public void launchFuncation(String intent){
        String path="";
        String[] split = intent.split("&");
        if (split.length==2) {
            if (split[0].equals("invengo_library")) {
                switch (split[1]){
                    case "search_book":
                        path = "/robot/Search";
                        break;
                    case "search_popular":
                        path = "/robot/Popular";
                        break;
                    case "search_activity":
                        path = "/robot/Advert";
                        break;
                }
            }
        }
        ARouter.getInstance().build(RouterActivityPath.Robot.ROBOT_MAIN).withString("path", path).navigation();
    }
}
